﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SGRapidForm.Permission.Service.Interface;
using SGRapidForm.Permission.Entity;
using SGRapidForm.Permission.Component;
using System.Collections.Specialized;
using SGRapidForm.Common;
using System.Data;
using Microsoft.Practices.Unity;

namespace SGRapidForm.Permission.Service
{
    public partial class PermissionService : IPermissionService
    {
        [Dependency]
        public RoleComponent RoleComponent
        { get; set; }

        /// <summary>
        /// 新增一个角色
        /// </summary>
        /// <param name="Role"></param>
        /// <returns></returns>
        public bool Role_Add(Role Role)
        {
            return this.RoleComponent.Role_Add(Role);
        }

        public bool Role_Delete(string keyid)
        {
            return this.RoleComponent.Role_Delete(keyid);
        }

        public bool Role_BulkDelete(string keyids)
        {
            return this.RoleComponent.Role_BulkDelete(keyids);
        }

        public bool Role_Update(Role Role)
        {
            return this.RoleComponent.Role_Update(Role);
        }

        public List<Role> Role_FilteredGetAll(string filterConditions)
        {
            return this.RoleComponent.Role_FilteredGetAll(filterConditions);
        }

        public Role Role_GetByKeyid(string keyid)
        {
            return this.RoleComponent.GetByKeyid(keyid);
        }

        /// <summary>
        /// 查询指定用户被分配的角色
        /// </summary>
        public List<Role> Role_GetByUserKeyid(string userKeyid)
        {
            return this.RoleComponent.GetByUserKeyid(userKeyid);
        }

        /// <summary>
        /// 查询指定用户未被分配的角色
        /// </summary>
        public List<Role> Role_GetUnmappedByUserKeyid(string userKeyid)
        {
            return this.RoleComponent.Role_GetUnmappedByUserKeyid(userKeyid);
        }

        /// <summary>
        /// 清除所有角色
        /// </summary>
        public bool Role_Clear()
        {
            return this.RoleComponent.Role_Clear();
        }
    }
}
